//
// Created by 215609 on 2024/7/2.
//

#ifndef AUDIOCAMERA_TSFFMPEG_H
#define AUDIOCAMERA_TSFFMPEG_H
#include "pthread.h"
#include "TSAudio.h"
#include "TsCallJava.h"
#include "TSPlayerStatus.h"
extern "C" {
#include "libavformat/avformat.h"
}

class TSFFmpeg {

    ~TSFFmpeg();

public:
    pthread_t  decodeThread;
//    const char *source;
    TSAudio *mTSAudio=nullptr;
    AVFormatContext *avFormatContext;

    TSPlayerStatus *mTSPlayerStatus;
    TsCallJava *callJava;
    const char *url;
    pthread_mutex_t seek_mutex;

    int duration = 0;
public:
   void prepare();
   void pasue();

   void seek(jint secds);

   void decodeFFmpegThread();
   void resume();

   void setVolume(int volume);
   void start();
   void setMute(jint mute);

    TSFFmpeg(TSPlayerStatus *mTSPlayerStatus,TsCallJava *callJava,const char *url);
};


#endif //AUDIOCAMERA_TSFFMPEG_H
